|
|
|
|
|
|
|
strBuffer = String(BUFFERLEN, 0)
intRows = 0
'
' get data
Do
intResult = FetchRow() ' get a row
Select Case intResult
Case sqlNoDataFound
If intRows > 0 Then
Exit Do ' we're done
Else
Refresh = sqlerr
Exit Function
End If
Case sqlSuccess
intRows = intRows + 1
strItem = ""
For intLoop = 1 To intCols
intResult = GetColumn(strBuffer, intLoop)
SaveColumn strItem, strBuffer
Next ' get another column
SaveRow strItem
Case Else
intResult = SQLFreeStmt(hStmt, sqlClose)
Refresh = sqlerr
Exit Function
End Select
Loop ' get another row
'
intRecNum = 0 ' clear record pointer
intRecordCount = intRows
Refresh = sqlSuccess
frmSQLData.Refresh
'
End Function |
|
|
|
|
|
|
|
|
The routine in Listing 19.11 performs a number of important tasks. First, it calls the internal ExecDirect method. This method executes the actual SQL statement. Then, after returning from the ExecDirect call, the routine gets the number of data columns and clears a utility form that holds a rich text control. This rich text control is used as an internal buffer area for the downloaded dataset. You build that form in just a moment. Finally, a Do loop is established to collect each column of data and save it as a new row. When all rows have been collected, the routine exits. |
|
|
|
|
|
|
|
|
Now add a single form to your project. Set its Name property to frmSQLData. Add a rich text control to the form and set its Name property to rtbSQLData. Now save the form as frmSQLData. It should look similar to the form shown in Figure 19.9 at this point. You refer to this form again later in the project. |
|
|
|
|
|